package com.cooud.order.feign;

import com.cooud.order.feign.fallback.ProductFeignClientFallback;
import com.cooud.product.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: DongGuoZhen
 * @Date: 2025/03/16/13:14
 * @Description:
 */
@FeignClient(value="service-product",fallback = ProductFeignClientFallback.class)  // 声明Feign客户端 发送远程调用的客户端
public interface ProductFeignClient {


//    标注在controller上，是接收请求

//    发送get请求  自动负载均衡，请求到对应的服务
    @GetMapping("/product/{id}")
    Product getProductById(@PathVariable("id") Long id);

}
